const path = require("path");
const webpack = require("webpack");
module.exports = {
    lintOnSave: false,
    chainWebpack: (config) => {
        const types = ["vue-modules", "vue", "normal-modules", "normal"];
        types.forEach((type) =>
            addStyleResource(config.module.rule("less").oneOf(type))
        );
        config.plugin("provide").use(webpack.ProvidePlugin, [{
            $: "jquery",
            jquery: "jquery",
            jQuery: "jquery",
            "window.jQuery": "jquery",
        }, ]);
    },
    publicPath: "./",
};

function addStyleResource(rule) {
    rule
        .use("style-resource")
        .loader("style-resources-loader")
        .options({
            patterns: [path.resolve(__dirname, "./src/assets/less/global.less")],
        });
}